package com.magic.gre.js.wordscount;

import android.webkit.JavascriptInterface;

import com.magic.gre.helper.Apphelper;
import com.noname.lib_base_java.util.L;

/**
 * Author: Lmoumou
 * Date: 2019-01-30 10:34
 * 文件名: JsBridge
 * 描述:桥接H5
 */
public class WordsJsBridge {

    private static final String TAG = "WordsJsBridge";

    private WordsJSCallBack jsCallBack;

    public WordsJsBridge(WordsJSCallBack jsCallBack) {
        this.jsCallBack = jsCallBack;
    }

    /*测试方法*/
    @JavascriptInterface
    public void test(String content) {
        L.e(TAG, "test:content->" + content);
    }

    /*提供用户Token*/
    @JavascriptInterface
    public String getToken() {
        L.e(TAG, "getToken");
        return Apphelper.getToken();
    }

    /*分享*/
    @JavascriptInterface
    public String share() {
        L.e(TAG, "share");
        jsCallBack.share();
        return "Android";
    }

    /*未登录*/
    @JavascriptInterface
    public void noLogin() {
        L.e(TAG, "noLogin");
        jsCallBack.noLogin();
    }

    /*分享Id*/
    @JavascriptInterface
    public void getAppUrlId(String shareId) {
        L.e(TAG, "getAppUrlId->" + shareId);
        jsCallBack.getAppUrlId(shareId);
    }


}
